package com.wu.exception;

/**
 * @Description: 业务异常
 */
public class BusinessException extends RuntimeException {

    private EnumInterface<String,String,String> errorCode;
    private String msg;

    public BusinessException() {
        super();
        errorCode = ProjectExceptionEnum.SYSTEM_ERROR;
    }

    public BusinessException(String message) {
        super(message);
        errorCode = ProjectExceptionEnum.SYSTEM_ERROR;
        msg = message;
    }

    public BusinessException(String code, String message) {
        super(message);
        errorCode = ProjectExceptionEnum.UN_ERROR;
        errorCode.setCode(code);
        errorCode.setMsg(message);
    }

    public BusinessException(String message, Throwable e) {
        super(message, e);
        errorCode = ProjectExceptionEnum.SYSTEM_ERROR;
        msg = message;
    }

    public BusinessException(Throwable e) {
        super(e);
        errorCode = ProjectExceptionEnum.SYSTEM_ERROR;
        msg = e.getMessage();
    }

    public BusinessException(EnumInterface enumInterface) {
        super();
        errorCode = enumInterface;
    }

    public BusinessException(EnumInterface enumInterface, Throwable e) {
        super(e);
        errorCode = enumInterface;
    }

    public BusinessException(String message, EnumInterface enumInterface) {
        super(message);
        errorCode = enumInterface;
    }

    public BusinessException(String message, EnumInterface enumInterface, Throwable e) {
        super(message, e);
        errorCode = enumInterface;
    }

    public EnumInterface getErrorCode() {
        return errorCode;
    }

    public String getMsg() {
        return msg;
    }
}
